<!-- 
	In an xml file like this we define an Entity to be used inside the engine.
	Entities are all the objects used in a game. Like Player, enemy monsters, falling bricks 
	event triggers and weather controllers.
-->

<!-- Entity is the root of the xml file category is a ID string used by scripts.-->
<Entity category="OurCategory">

	<!-- 
		Entity can contain any of the following children
		Draw,Physics,Scripts,Properties.
		All are optional.
		So we can define an Entity with Draw and Physics but no scripts or properties to act like an obstacle.
		Also we can define an Entity with only Scripts to act like a gameplay mechanism like a weather controller or an achievement system.
	-->
	
	<!-- 
		Draw describes the draw logic of the entity. It can be either Anime or Simple.
		Simple can't contain a AnimationTable
	-->
	<Draw type="Anime">
		<!-- 
			both Anime and Simple have the Resource tag
			
			Resource describes the texture needed for this entity.
			fname if the filename of the texture presumed that it is located in the $ROOT$IMAGES directory.
			scale determines the dimension of the draw logic. 1,1 means that the texture will be rendered at the original size.
			Lesser values mean smaller and higher values mean bigger. Also x and y can be different so 0.5,2 is a valid value.
			color is the tint of the of the entity in RGBA values [0 - 255].
		-->
		<Resource fname="sakuraI.png" scale="1,1" />
		
		<Blending color="230,230,230,255" method="Alpha"/>
		
		<!-- Animation table is a complex one -->
		<!-- 
			default used to define an animation in which the system will return.
					e.x. player hits and then returns to the default animation.
			offset describes the way frames will be defined.
					if contHeight is selected each startRect will assume that its start is not the given one
					but the height of all frames prior it.
					if contWidth is selected each startRect will assume that its start is not the given one
					but the width of all frames prior it.
					if offset is not present there will be no offset.
		   startPlaying used in conjuction with deafult. If true the default animation will start playing upon creation.
		-->
		<AnimationTable default="StandR" offset="contHeight" startPlaying="true">
		
			<!-- 
			Aninamation 
			name : Used by the scripting system to refer to certain animations.
			(startrect or as) 
							startRect to indicate the first frame of the animation or 
							as to indicate that this animation has the same properties as one other already defined one.
			frames (optional if as was selected) the number of frames of the animation.
			time (optional if as was selected) the total time this animation will play.
			flipX (optional in any case) all frames will be mirrored in the X axis, default is false.
			flipY (optional in any case) all frames will be mirrored in the Y axis, default is false.
			-->
			
			<Animation name="WalkR" startRect="0,0,59,39" frames="6" time="60" flipX="false" flipY="false"/>
			<Animation name="StandR" startRect="0,0,56,33" frames="5" time="80"/>
			<Animation name="JumpUpR" startRect="0,0,67,32" frames="2" time="60"/>
			<Animation name="JumpDownR" startRect="0,0,55,37" frames="2" time="50"/>
			<Animation name="LandR" startRect="0,0,53,37" frames="2" time="100"/>
			<Animation name="WalkL" as="WalkR" flipX="true" flipY="false"/>
			<Animation name="StandL" as="StandR" flipX="true" />
			<Animation name="JumpUpL" as="JumpUpR" flipX="true"/>
			<Animation name="JumpDownL" as="JumpDownR" flipX="true" />
			<Animation name="LandL" as="LandR" flipX="true"/>
			
		</AnimationTable>
		
	</Draw>
	
	<!-- Physics Element describes the physical aspect of an Entity. -->
	<!-- Currently the only type is Simple. All attributes of Physics are optional.
	     ignoreGeneralForces - if true forces as gravity or wind won't apply their effects on this entity, default is false.
		 canSleep - describes if the physics engine can let this entity sleep(stop updating it if it's not in motion).
				  Entities like player which move all the time are better with setting this off. Default is false.
		 ghost - If true this entity will participate in the logical aspect of collisions ( notify scripts etc.) but will not have a physical response
		         to the collision (will not move beacause of the collision or bounce). This is about entity per entity collisions.
				 Entity per tile collisions are unaffected by this flag. Default is false.				
	-->
	<Physics type="Simple" ignoreGeneralForces="true" canSleep="false" ghost="false">
		<!-- 
			The mass of the entity. Higher mass means higher move ressistance.
			This tag is Required.
		-->
		<Mass value="1" CoG="future value" CoI="future value"/>
		<!-- 
			The boundig box of this entity.
			If no rect is determined the dimensions of the texture multiplied by the scale will be used as bounding box.
		-->
		<Rect value="0,0,57,33" />
		<!-- 
			Describes how this entity reacts to collisions (both entity per entity and entity per tile).
			bounce [0 - 1] where 0 is no bounce and 1 is no loss in motion (full bounce).
			friction is not in use currently 
			This tag is Required.
		-->
		<Material bounce="0" friction="0.3"/>
		<!-- Simulates the air ressistance and friction from he ground.
			 value [0 - 1] if the percentage of velocity which is subtracted from this entity's velocity per update.
			 With the two flags we can controll the axis on which damping takes place.
		-->
		<Damping value="0" applyonX="true" applyonY="false"/>
	</Physics>
	
	<!-- In Scripts Lua script files are included in this entity. -->
	<!-- 
		We can modify primitive properties of a script object, such as ints,
		bool, floats, strings using the Property XML tag inside the
		Script tag.
		
		Property tag is optional and if it is used its not necessary to initialize all properties of
		the script.
	-->
	<Scripts>
			<!-- file Move.lua will be included in this Entity's script list. -->
			<Script file="Move.lua">
				<!-- And its speed will be initialized to 100 -->
				<Property name="speed" value="100"/>
			</Script>
			<!-- Also script file Collector.lua will be included. -->
            <Script file="Collector.lua"/>
    </Scripts>
	
	<!-- In properties variables used by the scripts are declared. -->
	<!-- Allowed types are int, float, double, string and Vector2F. -->
	<!-- Value is essential. -->
	<Properties>
		<int name='score' > 0 </int>
	</Properties>
	
</Entity>